import kotlin.reflect.jvm.internal.impl.SpecialJvmAnnotations;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class TestPanel {
    /*
    Panle测试
     */
    public static void main(String[] args) {
        Frame frame = new Frame();
        //布局的概念
        Panel panel = new Panel();


        //设置布局
        frame.setLayout(null);
        frame.setBounds(600,600,400,400);
        frame.setBackground(new Color(20,150,0));
        //面板设置于窗口中
        panel.setBounds(50,50,400,400);
        panel.setBackground(new Color(203, 101, 101));
        frame.add(panel);//将面板添加进frame中
        //设置可见性
        frame.setVisible(true);
        //监听窗口关闭事件
        //适配器模式
        frame.addWindowListener(new WindowAdapter() {
            //窗口点击关闭时需要做的事情
            @Override
            public void windowClosing(WindowEvent e) {
                super.windowClosing(e);
                //结束程序，0就是正常退出。1就是异常退出
                System.exit(0);
            }
        });

    }
}
